﻿using ServerListerner.Connections;
using ServerListerner.Helper;

using System;
using System.Drawing;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Sockets;
using System.Reflection;

namespace ServerListerner
{
    public class UDPServer
    {
        public static IUDPServer? Create(int port)
         => ServerEntry.StartConnection<IUDPServer>(new object[] { port });
        public static IUDPServer? Create(IPAddress ipaddr, int port)
         => ServerEntry.StartConnection<IUDPServer>(new object[] { ipaddr, port });
        public static IUDPServer? Create(string ip, int port)
         => ServerEntry.StartConnection<IUDPServer>(new object[] { ip, port });
    }
    public class TCPServer
    {
        public static ITCPServer? Create(int port)
         => ServerEntry.StartConnection<ITCPServer>(new object[] { port });
        public static ITCPServer? Create(IPAddress ipaddr, int port)
         => ServerEntry.StartConnection<ITCPServer>(new object[] { ipaddr, port });
        public static ITCPServer? Create(string ip, int port)
         => ServerEntry.StartConnection<ITCPServer>(new object[] { ip, port });
    }

    public class HTTPServer
    {
        public static IHTTPServer? Create(int port)
         => ServerEntry.StartConnection<IHTTPServer>(new object[] { port });
        public static IHTTPServer? Create(IPAddress ipaddr, int port)
         => ServerEntry.StartConnection<IHTTPServer>(new object[] { ipaddr, port });
        public static IHTTPServer? Create(string ip, int port)
         => ServerEntry.StartConnection<IHTTPServer>(new object[] { ip, port });
    }
}